package com.wtgroup.demo.mianshi.jvm;

import java.util.concurrent.TimeUnit;

/**
 * @author dafei
 * @version 0.1
 * @date 2021/3/17 16:45
 */
public class D_ArthasRetransform {
    /**
     * arthas 热替换
     *
     * retransform
     * */

    public static void main(String[] args) {
        int i = 0;
        while (++i > 0) {
            foo(i);
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    // 另起方法, 执行以下旧退出. 退出的方法, 热替换才有效
    private static void foo(int i) {
        System.out.println("滴答... " + i);
    }

}
